package net.lab1024.sa.admin.module.business.roland.controller;

import net.lab1024.sa.admin.module.business.roland.domain.form.RolandCustomerAddForm;
import net.lab1024.sa.admin.module.business.roland.domain.form.RolandCustomerQueryForm;
import net.lab1024.sa.admin.module.business.roland.domain.form.RolandCustomerUpdateForm;
import net.lab1024.sa.admin.module.business.roland.domain.vo.RolandCustomerVO;
import net.lab1024.sa.admin.module.business.roland.service.RolandCustomerService;
import net.lab1024.sa.common.common.domain.ValidateList;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import net.lab1024.sa.common.common.domain.ResponseDTO;
import net.lab1024.sa.common.common.domain.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.validation.Valid;

/**
 * 客户信息表 Controller
 *
 * @Author dragon
 * @Date 2023-12-11 13:27:12
 * @Copyright dragon
 */

@RestController
@Api(tags = "")
public class RolandCustomerController {

    @Autowired
    private RolandCustomerService rolandCustomerService;

    @ApiOperation("分页查询 @author dragon")
    @PostMapping("/rolandCustomer/queryPage")
    public ResponseDTO<PageResult<RolandCustomerVO>> queryPage(@RequestBody @Valid RolandCustomerQueryForm queryForm) {
        return ResponseDTO.ok(rolandCustomerService.queryPage(queryForm));
    }

    @ApiOperation("添加 @author dragon")
    @PostMapping("/rolandCustomer/add")
    public ResponseDTO<String> add(@RequestBody @Valid RolandCustomerAddForm addForm) {
        return rolandCustomerService.add(addForm);
    }

    @ApiOperation("更新 @author dragon")
    @PostMapping("/rolandCustomer/update")
    public ResponseDTO<String> update(@RequestBody @Valid RolandCustomerUpdateForm updateForm) {
        return rolandCustomerService.update(updateForm);
    }

    @ApiOperation("批量删除 @author dragon")
    @PostMapping("/rolandCustomer/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return rolandCustomerService.batchDelete(idList);
    }

    @ApiOperation("单个删除 @author dragon")
    @GetMapping("/rolandCustomer/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return rolandCustomerService.delete(id);
    }
}
